(add-hook 'c-mode-hook
          (lambda()
            ( c-set-style "k&r" )
            (setq c-basic-offset 8)))

(setq compile-command "make")
(global-set-key [(f4)] 'compile)

;;open mutiple shell buffer at same time
(add-hook 'shell-mode-hook 'rename-uniquely)
(add-hook 'shell-mode-hook
         'ansi-color-for-comint-mode-on)
(add-hook 'term-mode-hook 'rename-uniquely)

;; ===== Set the highlight current line minor mode =====

;; In every buffer, the line which contains the cursor will be fully
;; highlighted

;;(global-hl-line-mode 3)

;;display time,date and determine the date farmat on the mode line.
 (display-time-mode 1)
   (setq display-time-24hr-format t)
     (setq display-time-day-and-date t)
       (setq display-time-use-mail-icon t)
         (setq display-time-interval 10)
;;use "y" and "n" instead "yes" and "no".
(fset 'yes-or-no-p 'y-or-n-p)

(setq-default line-spacing 2)

;;set forgefround,background,highlight corlors and so on.

;;(set-keyboard-coding-system ' utf-8)

;;language environment.
;;(set-language-environment 'utf-8)

;;syntax highlighting enable.
(global-font-lock-mode t)

;;disable the startup message(picture).
(setq inhibit-startup-message t)

;dispaly column number
(setq column-number-mode t)

;;do not copy text to the point of mouse,copy it to the location of cursor.  
(setq mouse-yank-at-point t)
(setq default-fill-column 60)
(show-paren-mode t)
(setq show-paren-style 'parentheses)

;;move the mouse farther from the cursor.
(mouse-avoidance-mode 'animate)

;;set emacs's title. "%b" is file name.
(setq frame-title-format "emacs   @   %b")


(auto-image-file-mode t)
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'LaTeX-hide-environment 'disabled nil)
(setq version-control t)
(setq kept-new-versions 3)
(setq delete-old-versions t)
(setq kept-old-versions 2)
(setq dired-kept-versions 1)
(mouse-wheel-mode t)(setq scroll-step 1
scroll-margin 3
scroll-conservatively 10000)
(setq require-final-newline t)


;; no toolbar.
(tool-bar-mode -1)
;(menu-bar-mode -1)

;;set name and address.
(setq user-full-name "Fish")
(setq user-mail-address "fisherss@hotmail.com")


;; a function used to comment a line

(defun fish-comment-line()
  (interactive)
  (comment-region (line-beginning-position) (line-end-position)))

(global-set-key (kbd "C-M-;") 'fish-comment-line)
;;====================

;; (create-fontset-from-fontset-spec
;;    "-*-courier-medium-r-*-*-14-*-*-*-*-*-fontset-song,\
;;    chinese-gb2312:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1,\
;;    chinese-gbk:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1,\
;;    chinese-gb18030:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1,\
;;    chinese-big5:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1,\
;;    big5:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1,\
;;    utf-8:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1,\
;;    chinese-cns11643-5:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1,\
;;    chinese-cns11643-6:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1,\
;;    chinese-cns11643-7:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1")
;; (set-default-font "fontset-song")
;; (add-to-list 'after-make-frame-functions
;;    (lambda (new-frame) (select-frame new-frame)
;;       (set-default-font "fontset-song"))) 
;; ;;--------------------

;; ;; (create-fontset-from-fontset-spec
;; ;; "-*-courier-medium-r-normal-*-14-*-*-*-*-*-fontset-courier")
;; ;; (set-default-font "fontset-courier")
;; ;; (setq default-frame-alist
;; ;; (append
;; ;; '((font . "fontset-courier")) default-frame-alist)) 
;; ;;--------------------
;; ;; (create-fontset-from-fontset-spec
;; ;; "-*-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-fontset-courier")
;; ;; (set-default-font "fontset-courier")
;; ;; (setq default-frame-alist
;; ;; (append
;; ;; '((font . "fontset-courier")) default-frame-alist)) 
;; ;; ;;--------------------

;; ;;------------------------------
;; (create-fontset-from-fontset-spec
;; "-*-dejavu sans mono-medium-r-normal-*-14-*-*-*-*-*-fontset-sans")

;; (set-fontset-font
;; "fontset-default" nil
;; "-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1" nil 'prepend)
;; (set-fontset-font
;; "fontset-sans" 'kana
;; "-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1" nil 'prepend)
;; (set-fontset-font
;; "fontset-sans" 'han
;; "-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1" nil 'prepend)
;; (set-fontset-font
;; "fontset-sans" 'cjk-misc
;; "-wenquanyi-wenquanyi bitmap song-medium-r-*-*-*-*-*-*-*-*-iso10646-1" nil 'prepend)

;; (set-default-font "fontset-sans")

;; (setq default-frame-alist
;; (append
;; '((font . "fontset-sans")) default-frame-alist)) 

